[RF] Don't do dirty state propagation if more than 2 params changed #20044
+26
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The "dirty state propagation" is the mechanism that figures out which parts of the computation graph need to be re-evaluated.
It can be quite expensive if all the parameters in the model are changed at once, for example in the Minuit 2 line search step.
Changing only 1 or 2 parameters is common during numerical differentiation. But in the minimizer algorithms like Minuit 2, we can generally assume that if more than 2 parameter changed, then all of them are changed. Therefore, we should implement some mechanism that skips the dirty flag propagation in that case. This will greatly speed up fits with many parameters, especially when using AD, where the line search dominates the runtime. For ATLAS Higgs combinations, a speedup of 2x for minimization is expected.
To make some initial studies, this draft PR is opened with a relatively hacky way to implement this, using global state in RooFit.